from django import forms
from captcha.fields import CaptchaField

# 登录时用的用户表单
class UserForm(forms.Form):
    # widget是方便后面使用boostrap
    username = forms.CharField(label="用户名", max_length=128, widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': "Username",'autofocus': ''}))
    password = forms.CharField(label="密码", max_length=256, widget=forms.PasswordInput(attrs={'class': 'form-control','placeholder': "Password"}))
    captcha = CaptchaField(label='验证码')

# 注册时用的用户表单
class RegisterForm(forms.Form):
    gender = (
        ('male', "男"),
        ('female', "女"),
    )
    departments = (
        ('部门一',"运营部"),
        ('部门二',"销售部"),
        ('部门三',"生产部"),
        ('部门四',"安全部"),
    )
    partyments = (
        ('一支部',"铝合金"),
        ('二支部',"轻量化"),
        ('三支部',"建材"),
        ('四支部',"预算"),
    )
    username = forms.CharField(label="用户名", max_length=128, widget=forms.TextInput(attrs={'class': 'form-control'}))

    num = forms.CharField(label = "工号",max_length=256,widget=forms.TextInput(attrs={'class':'form-control'}))
    sex = forms.ChoiceField(label="性别", choices=gender)
    dept = forms.ChoiceField(label="部门",choices=departments)
    party = forms.ChoiceField(label="党支部",choices=partyments)

    email = forms.EmailField(label="邮箱地址", widget=forms.EmailInput(attrs={'class': 'form-control'}))
    password1 = forms.CharField(label="密码", max_length=256, widget=forms.PasswordInput(attrs={'class': 'form-control'}))
    password2 = forms.CharField(label="确认密码", max_length=256,widget=forms.PasswordInput(attrs={'class': 'form-control'}))
    captcha = CaptchaField(label='验证码')
